#include "Stack.h"

#ifndef STACK_H
#define STACK_H
const int NMAX = 500000;
struct Stack {
	int data[NMAX];
	int size;
};
#endif


extern void
Clear(struct Stack * s)
{
	s->size = 0;
}



extern void
Push(struct Stack * s, int new_)
{
	s->data[s->size] = new_;
	++(s->size);
}



extern int
Pop(struct Stack * s)
{
	if (s->size)
		--s->size;
	return s->data[s->size];
}



extern int
Top(const struct Stack * s)
{
	return s->data[s->size - 1];
}



extern unsigned char
IsEmpty(const struct Stack * s)
{
	return s->size ? 0 : 1;
}
